package light.head.model;

import java.io.Serializable;
import java.util.Date;
import java.util.List;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.persistence.Transient;

import org.hibernate.annotations.Formula;
/**
 * 领用明细表
 */
@Entity
@Table
public class ConsumingItem implements Serializable{

	
	private static final long serialVersionUID = 7387432202080668804L;
	
	
	private Integer code;
	private Integer coc;						// 领用信息编号
	private Integer count;						// 领用数量
	private Boolean deleted = false;			// 是否删除
	private Integer price;						// 价格（现值）
	private Integer gc;							// 物品编号
	private Date rt;							// 预计归还时间
	
	
	
	private Byte sort;
	private String gn;							// 物品名称
	private List<ConsumingDetail> detailList;	// 标签			
	
	
	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	@Column
	public Integer getCode() {
		return code;
	}
	@Column
	public Integer getCoc() {
		return coc;
	}

	@Column
	public Integer getCount() {
		return count;
	}

	@Column
	public Boolean getDeleted() {
		return deleted;
	}
	
	@Column
	public Integer getGc() {
		return gc;
	}

	@Column
	public Integer getPrice() {
		return price;
	}

	@Formula("(SELECT g.name FROM Goods g WHERE g.code = gc)")
	public String getGn() {
		return gn;
	}
	@Temporal(TemporalType.TIMESTAMP)
	@Column()
	public Date getRt() {
		return rt;
	}
	@Transient
	public List<ConsumingDetail> getDetailList() {
		return detailList;
	}
	@Formula("(SELECT g.sort FROM Goods g WHERE g.code = gc)")
	public Byte getSort() {
		return sort;
	}
	
	
	
	
	
	
	public void setSort(Byte sort) {
		this.sort = sort;
	}
	public void setDetailList(List<ConsumingDetail> detailList) {
		this.detailList = detailList;
	}
	public void setPrice(Integer price) {
		this.price = price;
	}

	public void setCode(Integer code) {
		this.code = code;
	}

	public void setCoc(Integer coc) {
		this.coc = coc;
	}
	public void setGc(Integer gc) {
		this.gc = gc;
	}


	public void setCount(Integer count) {
		this.count = count;
	}
	public void setRt(Date rt) {
		this.rt = rt;
	}


	public void setDeleted(Boolean deleted) {
		this.deleted = deleted;
	}

	public void setGn(String gn) {
		this.gn = gn;
	}
	
	
}
